package com.cwl.utils;

import com.cwl.common.exception.UEException;
import org.apache.commons.lang3.StringUtils;

/**
 * 数据校验
 */
public abstract class Assert {

    public static void isNotBlank(String str, String message) {
        if (StringUtils.isBlank(str)) {
            throw new UEException(message);
        }
    }

    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new UEException(message);
        }
    }

    public static void assertTrue(boolean condition, String message) {
        if (!condition) {
            throw new UEException(message);
        }
    }

    public static void lengthJudge(String str, int length,String message) {
        if (str.length() > length) {
            throw new UEException(message);
        }
    }
}
